<div style="width:725px; height:inherit; margin-left:10px; float:right;">
    <div id="boxContent" align="left">
        <div class="textformTop" style="color:#000; float:left;">Quản Lý Tài Khoản</div>
        <!--<div id="relaLink"><a href="#" style="color:#999;">Trang chủ</a> | <a href="#" style="color:#999;">Nạp tiền</a></div>-->
    </div>
    <div id="ContentContainer" align="center">
        <div>
            <div class="div-tab">
                <ul>
                    <li class="active">Ký Gửi</li>
                    <li>Thông Tin Giao Dịch
                    {{if isset($data['item-pending']) and count($data['item-pending']!=0)}}
                    <span id="alert3" class="kg_alert">{{count($data['item-pending'])}}</span>
                    {{else}}
                    <span id="alert3" class="kg_alert" style="display: none;"></span>
                    {{/if}}
                    </li>
                    <li>Kho</li>
                    <li>Lịch Sử Giao Dịch</li>
                </ul>
            </div>
            <div class="tab-container">
                <span id="kg-result"></span>
                <span class="title-1">Thông tin vật phẩm/vàng</span>
                    <table>
                        <form name="frmKygoi">
                        <tr>
                            <td class="td-head"><span class="required">*</span>Game</td>
                            <td>
                                {{if isset($data['game'])}}
                                <select name="game" id="slt-game">
                                    <option value="0">[--Chọn Game--]</option>
                                    {{foreach $data['game'] as $game}}
                                        <option value="{{$game->gid}}">{{$game->name}}</option>
                                    {{/foreach}}
                                </select>
                                {{/if}}
                            </td>
                        </tr>
                        <tr>
                            <td class="td-head"><span class="required">*</span>Server</td>
                            <td>
                                <select name="server" id="slt-server">
                                    <option>[--Chọn Server--]</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td class="td-head"><span class="required">*</span>Tên nhân vật</td>
                            <td><input name="character-name" class="in-text" type="text"/></td>
                        </tr>
                        <tr>
                            <td class="td-head"><span class="required">*</span>Loại</td>
                            <td>
                                <input id="radio-i" type="radio" name="item-type" value="1">Vật phẩm
                                <input id="radio-g" type="radio" name="item-type" value="2">Vàng
                                <!--<select name="type" id="slt-type">
                                    <option>[--Chọn Loại--]</option>
                                    <option value="1">Vật phẩm</option>
                                    <option value="2">Tiền/vàng trong game</option>
                                </select>-->
                            </td>
                        </tr>
                        <tr  id="tr-chname">
                            <td class="td-head"><span class="required">*</span>Tiêu đề</td>
                            <td><input name="item-name" class="in-text" type="text"/></td>
                        </tr>
                        <tr>
                            <td class="td-head"><span class="required">*</span>Số lượng</td>
                            <td><input name="item-amount" class="in-text" type="text"/></td>
                        </tr>
                        <tr>
                            <td class="td-head">Mô tả</td>
                            <td><textarea id="item-desc"></textarea></td>
                        </tr></form>
                        <tr>
                            <td class="td-head"><span class="required">*</span>Hình ảnh</td>
                            <td>
                                <form id="upload_img_form" enctype="multipart/form-data" action="{{'ajax_excution/uploadImage'|base_url}}" method="post">
                                    <input id="photoimg" name="userfile" class="in-text" multiple="multiple" type="file"/><input id="up_img_btn" type="button" value="Tải lên"/>
                                </form>
                                <div id="preview"></div>
                            </td>
                        </tr>
                        <tr>
                            <td class="td-head"><span class="required">*</span>Mã xác nhận</td>
                            <td><input id="kg_captcha" name="captcha" style="width: 100px;" class="in-text" type="text"/><img align="middle" src="{{base_url()}}library/captcha/securimage_show.php?t={{time()}}" onclick="changecaptcha('#img-captcha-kg');" id="img-captcha-kg" class="img-captcha"></td>
                        </tr>
                        <tr>
                            <td colspan="2" style="text-align: center;"><input id="btn-kygoi" class="btn-all" type="button" type="text" value="Đồng Ý"/><img  src="{{'layout/template/frontend/images/AjaxLoader.gif'|base_url}}" class="load-img"/></td>
                        </tr>
                    </table>
                
            </div>
            <div class="tab-container">
                <table class="tb_store" id="store1">
                    <tr>
                        <td>Vật Phẩm</td>
                        <td>Số Lượng</td>
                        <td>Server/Game</td>
                        <td>Thao Tác</td>
                        <td>Thông Báo</td>
                    </tr>
                    {{if isset($data['item-pending'])}}
                    {{if count($data['item-pending'])>0}}
                    {{foreach $data['item-pending'] as $item}}
                        {{$game = $db_game_model->getGameByGID($item->gid)}}
                        {{$server = $db_game_model->getServerBySID($item->sid)}}
                    <tr>
                        <td><img style="display: inline-block;" width="50" height="50" src="{{$item->image|base_url}}" /><br><span class="info2">{{$item->name}}</span></td>
                        <td>{{$item->amount}}</td>
                        <td>{{$server[0]->name}}/{{$game[0]->name}}</td>
                        <td>{{if $item->trans_order==1}}{{'Gửi'}}{{/if}}{{if $item->trans_order==-1}}{{'Rút'}}{{/if}}</td>
                        <td><span class="info3">{{if $item->confirm_order==1}}{{'Đồng ý giao dịch'}}{{/if}}{{if $item->confirm_order==-1}}{{'Hủy giao dịch'}}{{/if}}</span><br><br><a target="_blank" href="{{'giao-dich/'|cat:$item->transID|base_url}}">Xem chi tiết</a></td>
                    </tr>
                    {{/foreach}}
                    {{else}}
                    <tr>
                        <td colspan="4">Chưa có dữ liệu</td>
                    </tr>
                    {{/if}}
                    {{/if}}
                </table>
            </div>
            <div class="tab-container">
                <table class="tb_store">
                    <tr>
                        <td>Vật phẩm</td>
                        <td>Số Lượng</td>
                        <td>Server/Game</td>
                        <td>Thao tác</td>
                    </tr>
                    {{if isset($data['item'])}}
                    {{if count($data['item'])>0}}
                    {{foreach $data['item'] as $item}}
                        {{$game = $db_game_model->getGameByGID($item->gid)}}
                        {{$server = $db_game_model->getServerBySID($item->sid)}}
                    <tr>
                        <td><img style="display: inline-block;" width="50" height="50" src="{{$item->image|base_url}}" /><br><span class="info2">{{$item->name}}</span></td>
                        <td>{{$item->amount}}</td>
                        <td>{{$server[0]->name}}/{{$game[0]->name}}</td>
                        <td><a>Rao</a>|<a>Rút</a></td>
                    </tr>
                    {{/foreach}}
                    {{else}}
                    <tr>
                        <td colspan="4">Chưa có dữ liệu</td>
                    </tr>
                    {{/if}}
                    {{/if}}
                </table>
            </div>
            <div class="tab-container">
            
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function(){
            var newkgconfirm = setInterval(function(){
            $.ajax({
                url: base_url+'ajax_excution/getconfirmitem',
                type: 'POST',
                dataType: 'text',
                success:function(data){
                    var result = JSON.parse(data);//console.log(result);
                    if(result.code==1){
                        $("#alert3").html(result.msg.length);
                        $("#alert3").show();
                        var html = '<tr><td>Vật phẩm</td><td>Số Lượng</td>';
                        html += '<td>Server/Game</td>';
                        html += '<td>Thao Tác</td>';
                        html += '<td>Thông Báo</td></tr>';
                        
                        //danh sách
                        for(var i=0;i<result.msg.length;i++)
                        {
                            html += '<tr>';
                            html += '<td><img style="display: inline-block;" width="50" height="50" src="'+base_url+result.msg[i].image+'" /><br><span class="info2">'+result.msg[i].name+'</span></td>';
                            html += '<td>'+result.msg[i].amount+'</td>';
                            html += '<td>'+result.msg[i].server_name+'/'+result.msg[i].game_name+'</td>';
                            if(result.msg[i].trans_order==1)
                                html += '<td>Gửi</td>';
                            if(result.msg[i].trans_order==-1)
                                html += '<td>Rút</td>';
                            if(result.msg[i].confirm_order==1)
                                html += '<td><span class="info3">Đồng ý giao dịch</span><br><br><a target="_blank" href="'+base_url+"giao-dich/"+result.msg[i].transID+'">Xem chi tiết</a></td>';
                            if(result.msg[i].confirm_order==-1)
                                html += '<td><span class="info3">Hủy giao dịch</span><br><br><a target="_blank" href="'+base_url+"giao-dich/"+result.msg[i].transID+'">Xem chi tiết</a></td>';
                            html += '</tr>';
                        }
                        $("#store1").empty();
                        $("#store1").html(html);
                    }
                    else
                    {
                        clearInterval(newkgconfirm);
                    }
                },
                error:function(){}
            });
        }, 5000);
    })
</script>